import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.GroupLayout;
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.LayoutStyle;

import javax.swing.WindowConstants;
import javax.swing.SwingUtilities;


/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class ISS_SIMD_Advance_Settings extends javax.swing.JFrame {

	public static int user_entered_bitwidth;
	
	{
		//Set Look & Feel
		try {
			javax.swing.UIManager.setLookAndFeel(javax.swing.UIManager.getSystemLookAndFeelClassName());
		} catch(Exception e) {
			e.printStackTrace();
		}
	}

	private JButton jButton_advance_settings_OK;
	private JButton jButton_cancel;
	private JTextField jTextField_bitwidth;
	private JLabel jLabel_bitwidth;
	private JTextField jTextField_no_register;
	private JLabel jLabel_no_register;

	/**
	* Auto-generated main method to display this JFrame
	*/
	public static void main(String[] args) {
		SwingUtilities.invokeLater(new Runnable() {
			public void run() {
				ISS_SIMD_Advance_Settings inst = new ISS_SIMD_Advance_Settings();
				inst.setLocationRelativeTo(null);
				inst.setVisible(true);
			}
		});
	}
	
	public ISS_SIMD_Advance_Settings() {
		super();
		initGUI();
	}
	
	private void initGUI() {
		try {
			GroupLayout thisLayout = new GroupLayout((JComponent)getContentPane());
			getContentPane().setLayout(thisLayout);
			setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
			{
				jButton_advance_settings_OK = new JButton();
				jButton_advance_settings_OK.setText("OK");
				jButton_advance_settings_OK.addActionListener(new ActionListener() {
					public void actionPerformed(ActionEvent evt) {
						System.out.println("jButton_advance_settings_OK.actionPerformed, event="+evt);
						//TODO add your code for jButton_advance_settings_OK.actionPerformed
						//System.out.println(Cfu.NumberOfRegisters);

						Cfu.NumberOfRegisters = Integer.parseInt(jTextField_no_register.getText());
						user_entered_bitwidth =  Integer.parseInt(jTextField_bitwidth.getText());
						
						dispose();
						//System.out.println(Cfu.NumberOfRegisters);
					}
				});
			}
			{
				jButton_cancel = new JButton();
				jButton_cancel.setText("Cancel");
				jButton_cancel.addActionListener(new ActionListener() {
					public void actionPerformed(ActionEvent evt) {
						System.out.println("jButton_cancel.actionPerformed, event="+evt);
						//TODO add your code for jButton_cancel.actionPerformed
						dispose();
					}
				});
			}
			{
				jLabel_no_register = new JLabel();
				jLabel_no_register.setText("Enter number of registers in each CFU");
			}
			{
				jTextField_no_register = new JTextField();
				jTextField_no_register.setText("5");
			}
			{
				jLabel_bitwidth = new JLabel();
				jLabel_bitwidth.setText("Enter the bitwidth");
			}
			{
				jTextField_bitwidth = new JTextField();
				jTextField_bitwidth.setText("32");
			}
			thisLayout.setVerticalGroup(thisLayout.createSequentialGroup()
				.addContainerGap(26, 26)
				.addGroup(thisLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
				    .addComponent(jTextField_no_register, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
				    .addComponent(jLabel_no_register, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE))
				.addGap(20)
				.addGroup(thisLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
				    .addComponent(jTextField_bitwidth, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
				    .addComponent(jLabel_bitwidth, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE))
				.addGap(124)
				.addGroup(thisLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
				    .addComponent(jButton_advance_settings_OK, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
				    .addComponent(jButton_cancel, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE))
				.addContainerGap(64, 64));
			thisLayout.setHorizontalGroup(thisLayout.createSequentialGroup()
				.addContainerGap(46, 46)
				.addGroup(thisLayout.createParallelGroup()
				    .addComponent(jLabel_no_register, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
				    .addGroup(GroupLayout.Alignment.LEADING, thisLayout.createSequentialGroup()
				        .addComponent(jLabel_bitwidth, GroupLayout.PREFERRED_SIZE, 158, GroupLayout.PREFERRED_SIZE)
				        .addGap(61)))
				.addGroup(thisLayout.createParallelGroup()
				    .addGroup(GroupLayout.Alignment.LEADING, thisLayout.createSequentialGroup()
				        .addComponent(jButton_advance_settings_OK, GroupLayout.PREFERRED_SIZE, 77, GroupLayout.PREFERRED_SIZE)
				        .addGap(0, 100, Short.MAX_VALUE))
				    .addGroup(thisLayout.createSequentialGroup()
				        .addGap(33)
				        .addGroup(thisLayout.createParallelGroup()
				            .addGroup(GroupLayout.Alignment.LEADING, thisLayout.createSequentialGroup()
				                .addGap(0, 0, Short.MAX_VALUE)
				                .addComponent(jTextField_no_register, GroupLayout.PREFERRED_SIZE, 67, GroupLayout.PREFERRED_SIZE)
				                .addComponent(jButton_cancel, GroupLayout.PREFERRED_SIZE, 77, GroupLayout.PREFERRED_SIZE))
				            .addGroup(GroupLayout.Alignment.LEADING, thisLayout.createSequentialGroup()
				                .addComponent(jTextField_bitwidth, GroupLayout.PREFERRED_SIZE, 69, GroupLayout.PREFERRED_SIZE)
				                .addGap(0, 75, Short.MAX_VALUE)))))
				.addContainerGap(128, 128));
			pack();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

}
